package com.userfactssample.client.client.framework.event;

import com.userfactssample.client.client.framework.formItems.UMFormItem;
import com.userfactssample.client.client.framework.handler.UMFormActionHandler;

public class UMFormActionEvent extends UMClientEvent<UMFormActionHandler> {
	private static final Type<UMFormActionHandler> TYPE = new Type<UMFormActionHandler>();

	private UMFormItem eventSource;
	
	public UMFormActionEvent(UMFormItem eventSource) {
		super("ClientAction");
		this.eventSource = eventSource;
	}

	public UMFormItem getEventSource() {
		return eventSource;
	}

	@Override
	protected void dispatch(UMFormActionHandler handler) {
		handler.onAction(this);
	}

	@Override
	public Type<UMFormActionHandler> getAssociatedType() {
		return TYPE;
	}
}
